<?php							
		class CAttribute extends database
		{
			var $table = 'cdb_attribute';
			
			
		
			
			public function CAttributeList ()
			{
				$sql = 'select * from {$this->table} '	;
				$this->setQuery($sql);
				$this->query();
				$arrTemp =  $this->loadAllRow();
				
	
				return $arrTemp; 
			}
			
			public function CAttributeDetail ($id)
			{
				$sql="select * from $this->table where id='{$id}'";
				$this->setQuery($sql);
				$this->query();
				$arr=$this->loadAllRow();
				
				return $arr[0];
			}
			
			
			
			public function CAttributeAdd ($id,$id_unittype,$label,$status)
			{
				$sql = "INSERT INTO {$this->table} (`id`,`id_unittype`,`label`,`status`)
	VALUES ('{$id}','{$id_unittype}','{$label}','{$status}');";
				
				$this->setQuery($sql);
				$this->query();	
				
				
			}
			
			public function CAttributeUpdate ($id,$id_unittype,$label,$status)
			{
				$sql = "update $this->table set id ='{$id}',id_unittype ='{$id_unittype}',label ='{$label}',status ='{$status}' where id = '{$id}' ";
			
				$this->setQuery($sql);
				$this->query();
			}
			
			public function CAttributeDelete($id)
			{
				$sql="Delete from  $this->table where id='{$id}'";
				$this->setQuery($sql);
				$this->query();
			}
			
		}
	
	
	
	?>